﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>CDMS-city delivery</title>
<link rel="stylesheet" type="text/css"
	href="<c:url value="/resources/style.css" />">
</head>
<body>
	<section class="banner position-relative" id="home">
		<jsp:include page="../Header_act.jsp" />


		<div class="container">
			<div class="banner-text">
				<div class="slider-info">
					<div class="agileinfo-logo mt-lg-5">
						<h2>
							CDMS—— <br> 同城配送系统
						</h2>
					</div>
				</div>
			</div>
		</div>
	</section>
	<div class="col-md-12 column" style="width: 100%; text-align: center">
		<div class="managerList">
			<h1>管理员列表</h1>
			| <a href="<c:url value="/manager/addManager" />">添加管理员</a> | <br>
			<br>
			<form action="managerSearch" method="post"
				style="width: 100%; text-align: center">
				<c:choose>
					<c:when test="${type eq 'fullName'}">
						<select name="type">
							<option value="userName">用户名</option>
							<option value="fullName" selected="selected">姓名</option>
						</select>
					</c:when>
					<c:otherwise>
						<select name="type">
							<option value="userName">用户名</option>
							<option value="fullName">姓名</option>
						</select>
					</c:otherwise>
				</c:choose>
				<input name="search" placeholder="请输入查找内容" value="${search}" />
				<button>查找</button>
			</form>
			<div style="width: 100%; text-align: center">
				<table border="1" style="width: 100%; text-align: center">
					<tr>
						<th>管理员ID</th>
						<th>用户名</th>
						<th>姓名</th>
						<th>邮箱</th>
						<th>电话</th>
						<th>操作</th>
					</tr>
					<c:forEach items="${paginationSupport.items}" var="manager">
						<tr>
							<td><c:out value="${manager.id}" /></td>
							<td><c:out value="${manager.userName}" /></td>
							<td><c:out value="${manager.fullName}" /></td>
							<td><c:out value="${manager.email}" /></td>
							<td><c:out value="${manager.phoneNo}" /></td>
							<td><c:if test="${manager.id != sessionScope.manager.id }">
									<a
										href="<c:url value="/manager/managerInformation/${manager.id }" />"><button>修改</button></a>
									<a
										href="<c:url value="/manager/deleteManager/${manager.id }" />"><button>删除</button></a>
								</c:if></td>
						</tr>
					</c:forEach>
				</table>
			</div>
		</div>
		每页${paginationSupport.pageSize}条管理员信息，
		第${paginationSupport.currentPageNo}/${paginationSupport.totalPageCount}页,共${paginationSupport.totalCount}条管理员信息
		<c:if test="${paginationSupport.previousPage}">
			<c:choose>
				<c:when test="${not empty search }">
					<a
						href="<c:url value="/manager/managerSearch?pageNo=${paginationSupport.currentPageNo-1}&type=${type}&search=${search}" />">上一页</a>
				</c:when>

				<c:otherwise>
					<a
						href="<c:url value="/manager/managers?pageNo=${paginationSupport.currentPageNo-1}" />">上一页</a>
				</c:otherwise>
			</c:choose>
		</c:if>
		<c:if test="${paginationSupport.nextPage}">
			<c:choose>
				<c:when test="${not empty search }">
					<a
						href="<c:url value="/manager/managerSearch?pageNo=${paginationSupport.currentPageNo+1}&type=${type}&search=${search}" />">下一页</a>
				</c:when>

				<c:otherwise>
					<a
						href="<c:url value="/manager/managers?pageNo=${paginationSupport.currentPageNo+1}" />">下一页</a>
				</c:otherwise>
			</c:choose>
		</c:if>
	</div>
	<br><br><br>
	<jsp:include page="../Footer_act.jsp" />
</body>
</html>